package org.example.demo7;

import java.util.concurrent.ConcurrentHashMap;

/**
 *ConcurrentHashMap Apidemo
 */
public class Demo7 {
    public static void main(String[] args) {
        ConcurrentHashMap<String,String> map = new ConcurrentHashMap<>();
        String s1 = map.get("1"); //null
        String s2 = map.computeIfAbsent("1", Demo7::getData); //2_1
        String s3 = map.get("1");//2_1
        System.out.println();//断点
    }

    public static String getData(String x){
        return "2_"+x;
    }
}
